<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>24_字符串新增方法-trim-去空白</title>
    </head>
    <body>
        <script>
            // trim（）只能去除左右两端的空白
            var str = ' abc';
            console.log(str.length);
            console.log(str.trim().length);

            var str1 = 'abc ';
            console.log(str1.length);
            console.log(str1.trim().length);

            var str1 = 'ab c';
            console.log(str1.length);
            console.log(str1.trim().length);


        </script>
    </body>
</html>